<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script type="text/javascript">
description('Test for crbug.com/393504 :HTMLTextAreaElement.setSelectionRange should not change focus.');
window.jsTestIsAsync = true;
window.onload = function () {
    shouldBe("document.activeElement", "document.body");
    input.setSelectionRange(0, 0);
    shouldBe("document.activeElement", "document.body");
    input.setSelectionRange(2, 3);
    shouldBe("document.activeElement", "document.body");
    text.setSelectionRange(0, 0);
    shouldBe("document.activeElement", "document.body");
    text.setSelectionRange(2, 3);
    shouldBe("document.activeElement", "document.body");
    window.finishJSTest();
}
</script>
</head>
<body>
<input id="input" type="text" value="text1"/>
<textarea id="text" >text2</textarea>
</body>
</html>
